﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace YJKCopyModel.Basic
{
	public class RevitCategoryHelper
	{
		public Dictionary<string, BuiltInCategory> CategoryDic
		{
			get
			{
				return this.m_CategoryDic;
			}
			set
			{
				this.m_CategoryDic = value;
			}
		}

		public RevitCategoryHelper()
		{
			this.m_CategoryDic = this.GetEquipCategoryDic();
		}

		public Dictionary<string, BuiltInCategory> GetEquipCategoryDic()
		{
			return new Dictionary<string, BuiltInCategory>
			{
				{
					"机械设备",
					(BuiltInCategory)(-2001140)
				},
				{
					"风道末端",
					(BuiltInCategory)(-2008013)
				},
				{
					"照明设备",
					(BuiltInCategory)(-2001120)
				},
				{
					"灯具",
					(BuiltInCategory)(-2008087)
				},
				{
					"电气装置",
					(BuiltInCategory)(-2001060)
				},
				{
					"电气设备",
					(BuiltInCategory)(-2001040)
				},
				{
					"火警设备",
					(BuiltInCategory)(-2008085)
				},
				{
					"通讯设备",
					(BuiltInCategory)(-2008081)
				},
				{
					"数据设备",
					(BuiltInCategory)(-2008083)
				},
				{
					"护理呼叫设备",
					(BuiltInCategory)(-2008077)
				},
				{
					"电话设备",
					(BuiltInCategory)(-2008075)
				},
				{
					"安全设备",
					(BuiltInCategory)(-2008079)
				},
				{
					"风管附件",
					(BuiltInCategory)(-2008016)
				},
				{
					"管道附件",
					(BuiltInCategory)(-2008055)
				},
				{
					"卫浴装置",
					(BuiltInCategory)(-2001160)
				},
				{
					"停车场",
					(BuiltInCategory)(-2001180)
				},
				{
					"专用设备",
					(BuiltInCategory)(-2001350)
				},
				{
					"家具",
					(BuiltInCategory)(-2000080)
				}
			};
		}

		public BuiltInCategory GetCategoryFromDic(string key)
		{
			bool flag = this.m_CategoryDic == null || this.m_CategoryDic.Count <= 0 || string.IsNullOrEmpty(key);
			BuiltInCategory result;
			if (flag)
			{
				result = (BuiltInCategory)(-1);
			}
			else
			{
				bool flag2 = this.m_CategoryDic.ContainsKey(key);
				if (flag2)
				{
					result = this.m_CategoryDic[key];
				}
				else
				{
					result = (BuiltInCategory)(-1);
				}
			}
			return result;
		}

		public List<BuiltInCategory> GetCategorysFromDic(List<string> keys)
		{
			bool flag = this.m_CategoryDic == null || this.m_CategoryDic.Count <= 0 || keys == null || keys.Count <= 0;
			List<BuiltInCategory> result;
			if (flag)
			{
				result = new List<BuiltInCategory>();
			}
			else
			{
				List<BuiltInCategory> list = new List<BuiltInCategory>();
				foreach (string key in keys)
				{
					bool flag2 = this.m_CategoryDic.ContainsKey(key) && !list.Contains(this.m_CategoryDic[key]);
					if (flag2)
					{
						list.Add(this.m_CategoryDic[key]);
					}
				}
				result = list;
			}
			return result;
		}

		private Dictionary<string, BuiltInCategory> m_CategoryDic;
	}
}
